//
//  FirstViewController.m
//  Archer
//
//  Created by gu steve on 3/26/12.
//  Copyright (c) 2012 SteveGu. All rights reserved.
//

#import "HomeViewController.h"

@interface HomeViewController ()

-(void)TapMenu;

@end

@implementation HomeViewController

@synthesize menu = _menu;
@synthesize isMenuExtended = _isMenuExtended;

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
    // Show BadgeValue
    // self.tabBarItem.badgeValue = [NSString stringWithFormat:@"%d", 10];
    
    CGRect screenBounds = [[UIScreen mainScreen ] bounds];
    
    float padding = 60;
    float width = screenBounds.size.width - padding * 2;
    
    _menu = [[Menu alloc] initWithFrame:CGRectMake(60, 0, width, 50)];    
    _menu.userInteractionEnabled = YES;
    
    UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(TapMenu)];
    
    [_menu addGestureRecognizer:recognizer];
    
    [self.view addSubview:_menu];
    _isMenuExtended = NO;
    
}

-(void)TapMenu
{
    if(_isMenuExtended == YES)
    {
        [_menu Hide];
        _isMenuExtended = NO;
    }else {
        [_menu Show];
        _isMenuExtended = YES;
    }
    
}


-(void) ShowMenu:(UISwipeGestureRecognizer *) recognizer
{        
    [_menu Show];
}



-(void) HideMenu:(UISwipeGestureRecognizer *) recognizer
{
    [_menu Hide];
}


- (void)viewDidUnload
{
    [_menu release];
    
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

@end
